How to allow upgrade of regular shared hosting websites to a website on a virtual machine.
Overview
The components that make the upgrade process possible are Restatemachine and Atomia VPS Agent.
- Restatemachine orchestrates long running tasks by defining different steps that it performs in sequence.
- Atomia VPS Agent is deployed on the virtual machines and makes it possible to deploy a website inside of the virtual machine.
Image: Restatemachine and Atomia VPS Agent flowchart.
The restatemachine does the following when migrating a website to a virtual server:
- Waits for the VPS to be created and become available.
- Creates the website on the VPS:
- Copies website content from filesystem agent.
- Updates the preview DNS record of the website.
- Sets the migration to pending status.
- Waits for the migration to be approved. Approval is done by the customer by first previewing the website and then clicking Approve migration in the User Panel.
- When approved, updates the DNS records for the website. The old website is kept to avoid interruption of service.
- Waits for a configurable amount of time, verifies that the DNS changes has propagated and changes the old website service to a DNS-only service.
Installing restatemachine
- Add the Atomia public APT repo to the server and install packages.
- Modify configuration file /etc/restatemachine/restatemachine.conf.
- Restart restatemachine.
1 2 3 | repo= "$(wget -q -O - http://public.apt.atomia.com/setup.sh.shtml | sed s/%distcode/`lsb_release -c | awk '{ print $2 }'`/g)" ; echo "$repo" | sh apt-get update apt-get install restatemachine restatemachine-pack |
1 2 3 4 5 6 | # ListenOn = ":80" # Username = "deus" # Password = "exmachina" # TLSCertificateFile = "/some/certificate.pem" # TLSKeyFile = "/some/certificate_key.pem" # StateMachinePath = "/etc/restatemachine/statemachines" |
1 | service restatemachine restart |
Updating the Atomia Resource file
- Locate the resource file on the Automation Server machine at C:\Program Files (x86)\Atomia\AutomationServer\Common\Resources.xml.
- Modify it to fit the information in the configuration file above.
- Perform an IIS reset on the server and restart the three Atomia provisioning services to pick up the changes made.
1 2 3 4 5 6 7 8 9 10 11 12 | < bindings > < moduleList > < module name = "Atomia.Provisioning.Modules.RestateMachine.RestateMachine" resourceAsignmentPolicy = "RoundRobin" /> </ moduleList > < resourceList > < resource name = "RestateMachine1" > < property name = "Username" >deus</ property > < property name = "Password" >exmachina</ property > </ resource > </ resourceList > </ bindings > |
Enabling the upgrade option in Hosting Control Panel
- Modify the Domain manager plugin configuration located on the Hosting Control Panel server at C:\Program Files (x86)\Atomia\HostingControlPanel\bin\Atomia.Web.Plugin.Domains.dll.config.
- Change ManagedWebsiteEnabled plugin setting to true.
- Select Managed website as service when clicking Edit on a Linux/Apache website.
1 | < pluginSetting name = "ManagedWebsiteEnabled" value = "true" /> |